﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Web7.Configuration
{
    /// <summary>
    /// 默认的解析配置类
    /// </summary>
    public class DefaultConfigurationResolver:IConfigurationResolver
    {
        /// <summary>
        /// 获取配置节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <returns></returns>
        public object GetConfigSection(string name)
        {
            var config = ConfigurationManager.GetSection(name);
            if (config == null)
                throw new ConfigurationErrorsException(
                    string.Format("Cannot find '{0}' configuration section in application configuration.", name));
            return config;
        }
    }
}
